{#

This file is part of the Sonata package.

(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

#}

{% extends base_template %}

{% block actions %}
    <div class="sonata-actions">
        <ul>
            {% if admin.hasRoute('edit') and admin.isGranted('EDIT', object)%}
                <li class="btn sonata-action-element"><a href="{{ admin.generateObjectUrl('edit', object) }}">{% trans from 'SonataAdminBundle' %}link_action_edit{% endtrans %}</a></li>
            {% endif %}
            {% if admin.hasroute('history') and admin.id(object) and admin.isGranted('EDIT', object) %}
                <li class="btn sonata-action-element"><a href="{{ admin.generateObjectUrl('history', object) }}">{% trans from 'SonataAdminBundle' %}link_action_history{% endtrans %}</a></li>
            {% endif %}
            {% if admin.hasRoute('create') and admin.isGranted('CREATE')%}
                <li class="btn sonata-action-element"><a href="{{ admin.generateUrl('create') }}">{% trans from 'SonataAdminBundle' %}link_action_create{% endtrans %}</a></li>
            {% endif %}
            {% if admin.hasroute('list') and admin.isGranted('LIST')%}
                <li class="btn sonata-action-element"><a href="{{ admin.generateUrl('list') }}">{% trans from 'SonataAdminBundle' %}link_action_list{% endtrans %}</a></li>
            {% endif %}
        </ul>
    </div>
{% endblock %}

{% block side_menu %}{{ knp_menu_render(admin.sidemenu(action), {}, 'list') }}{% endblock %}

{% block show %}
    <div class="sonata-ba-view">
        {% for name, view_group in admin.showgroups %}
            <table class="bordered-table">
                {% if name %}
                    <tr class="sonata-ba-view-title">
                        <td colspan="2">
                            {{ admin.trans(name) }}
                        </td>
                    </tr>
                {% endif %}

                {% for field_name in view_group.fields %}
                    <tr class="sonata-ba-view-container">
                        {% if admin.show[field_name] is defined %}
                            {% if field_name == 'atributo' %}
                                tamandaré de pradomiruaro
                                  {% include 'ProdutosBundle:Produto:show_field.html.twig' with { nome: field_name} %}
                            {%else%}
                                {{ admin.show[field_name]|render_view_element(object) }}
                            {% endif %}
                        {% endif %}
                    </tr>
                {% endfor %}
            </table>
        {% endfor %}
    </div>
{% endblock %}

